package bean;

import java.util.HashMap;
import java.util.Map;

import com.xiaoleilu.hutool.StrUtil;

public class Request {
	private String method;
	private String url;
	private String protocol;
	private String version;
	private Map headerData;
	private String body;
	private Map parameterData;
	public Request(){
		headerData = new HashMap();
		setParameterData(new HashMap());
	}
	public String getMethod() {
		return method;
	}
	public void setMethod(String method) {
		this.method = method;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public Object getHeader(String key) {
		return headerData.get(key);
	}
	public void setHeader(String key,Object value) {
		this.headerData.put(key, value);
	}
	public String getBody() {
		return body;
	}
	public void setBody(String body) {
		this.body = body;
	}
	
	public Map getHeaderData() {
		return headerData;
	}
	public void setHeaderData(Map headerData) {
		this.headerData = headerData;
	}
	public String getProtocol() {
		return protocol;
	}
	public void setProtocol(String protocol) {
		this.protocol = protocol;
	}
	public String getVersion() {
		return version;
	}
	public void setVersion(String version) {
		this.version = version;
	}
	public Map getParameterData() {
		return parameterData;
	}
	public void setParameterData(Map parameterData) {
		this.parameterData = parameterData;
	}
	
	public Object getParameter(String key){
		if(StrUtil.isEmpty(key)){
			return null;
		}
		return parameterData.get(key);
	}
	
	public void setParameter(String key , Object value){
		if(StrUtil.isEmpty(key)){
			return;
		}
		parameterData.put(key, value);
	}
	
	public boolean containsParaName(String name){
		return parameterData.containsKey(name);
	}
}
